using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Pay.Data {
    public partial class ShopMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<Shop> {
        public ShopMap() {
            // table
            ToTable("mc_Shop", "dbo");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                .HasColumnName("Id")
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.MerchantId)
                .HasColumnName("MerchantId")
                .IsRequired();
            Property(t => t.ShopName)
                .HasColumnName("ShopName")
                .IsRequired();
            Property(t => t.Logo)
                .HasColumnName("Logo")
                .IsOptional();
            Property(t => t.Banner)
                .HasColumnName("Banner")
                .IsOptional();
            Property(t => t.Description)
                .HasColumnName("Description")
                .IsOptional();
            Property(t => t.Disabled)
                .HasColumnName("Disabled")
                .IsRequired();
            Property(t => t.RegionId)
                .HasColumnName("RegionId")
                .IsRequired();
            Property(t => t.SellerPhone)
                .HasColumnName("SellerPhone")
                .IsRequired();
            Property(t => t.CreateDate)
                .HasColumnName("CreateDate")
                .IsRequired();
            Property(t => t.RegionName)
                .HasColumnName("RegionName")
                .IsOptional();
            Property(t => t.Address)
                .HasColumnName("Address")
                .IsOptional();

            HasRequired(t => t.Merchant)
                .WithMany()
                .HasForeignKey(d => d.MerchantId)
                .WillCascadeOnDelete(false);
        }
    }
}
